﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="销售量.aspx.cs" Inherits="syc.Produce.销售量" %>

<html>
<head>
    <style type="text/css">
        .style1
        {
            width: 399px;
        }
    </style>
</head>
<body>

<script type="text/javascript" language="javascript" src="/common.js"></script>

    <form id="form1" runat="server">
        <div id="wintop" class="wintop">销售量</div>
        <asp:Panel ID="Panel1" runat="server" CssClass="panel">
        <input type="button" value="录 入" class="button" onclick="parent.swin2_load('/Produce/销售量_IN.aspx',380,170);"/>
            <asp:Panel ID="Panel3" runat="server" CssClass="panel" GroupingText="查 询">
                年 度：<asp:DropDownList ID="NianDu" runat="server" AutoPostBack="true" Width="120px">                    
                    <asp:ListItem>2009</asp:ListItem>
                    <asp:ListItem>2010</asp:ListItem>
                    <asp:ListItem>2011</asp:ListItem>
                    <asp:ListItem>2012</asp:ListItem>
                    <asp:ListItem>2013</asp:ListItem>
                    <asp:ListItem>2014</asp:ListItem>
                    <asp:ListItem>2015</asp:ListItem>
                </asp:DropDownList>
                月份：<asp:DropDownList ID="YueFen" runat="server">   
                    <asp:ListItem>1</asp:ListItem>              
                    <asp:ListItem>2</asp:ListItem>
                    <asp:ListItem>3</asp:ListItem>
                    <asp:ListItem>4</asp:ListItem>
                    <asp:ListItem>5</asp:ListItem>
                    <asp:ListItem>6</asp:ListItem>
                    <asp:ListItem>7</asp:ListItem>
                    <asp:ListItem>8</asp:ListItem>
                    <asp:ListItem>9</asp:ListItem>
                    <asp:ListItem>10</asp:ListItem>
                    <asp:ListItem>11</asp:ListItem>
                    <asp:ListItem>12</asp:ListItem>                  
                </asp:DropDownList>  
                 <asp:Button ID="Button_Query" runat="server" CssClass="button" 
                    OnClick="Button_Query_Click" Text="查 询" UseSubmitBehavior="False" />           
            </asp:Panel>
            
        </asp:Panel>
    <div class="gridframe">
        <div class="gridview">
        
            <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#e5cfab">
	            <tr>
		            <td class="grid-title">销售量</td>
		        </tr>
		        <tr>
		            <td class="grid-back">
<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
    ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
    
    SelectCommand="if(@月份!=0)
                   begin
                   SELECT                            
                          ID,[年份], [月份],[油管销售量],[套管销售量] FROM [销售量] 
                   WHERE [年份]=@年份
                   ORDER BY [年份], [月份]
                   end
                   else
                   begin
                   SELECT                            
                          ID,[年份], [月份],[油管销售量],[套管销售量] FROM [销售量] 
                   WHERE [年份]=@年份
                   ORDER BY [年份], [月份]
                   end                  
                   " 
    UpdateCommand="UPDATE [销售量] 
               SET [年份] = @年份, [月份] = @月份,[油管销售量]=@油管销售量,[套管销售量] = @套管销售量 WHERE [ID] = @ID" 
    DeleteCommand="DELETE FROM [销售量] WHERE [ID] = @ID" >
            <SelectParameters>
                <asp:ControlParameter ControlID="NianDu" PropertyName="SelectedValue" Name="年份" Type="Int32"/>
                <asp:ControlParameter ControlID="YueFen" PropertyName="SelectedValue" Name="月份" Type="Int32"  />
            </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="ID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="年份" Type="Int32" />
                <asp:Parameter Name="月份" Type="Int32" />
                <asp:Parameter Name="油管销售量" Type="Decimal" />
                <asp:Parameter Name="套管销售量" Type="Decimal" />       
                <asp:Parameter Name="ID" Type="Int32" />
            </UpdateParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
    AutoGenerateColumns="False" CssClass="grid" DataKeyNames="ID" 
    DataSourceID="SqlDataSource2" 
    GridLines="None" ondatabound="GridView1_DataBound" 
    onpageindexchanged="GridView1_PageIndexChanged" AllowSorting="True" 
    UseAccessibleHeader="False">
    <PagerSettings Visible="False" />
    <RowStyle CssClass="grid-row-normal" />
    <Columns>    
        <asp:TemplateField HeaderText="年份" SortExpression="年份">
            <ItemTemplate>
                <asp:Label ID="Label2" runat="server" Text='<%# Bind("年份") %>'></asp:Label>
            </ItemTemplate>
            <HeaderStyle CssClass="grid-header" />
            <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="100px" />                                      
        </asp:TemplateField>
        <asp:TemplateField HeaderText="月份" SortExpression="月份">
            <ItemTemplate>
                <asp:Label ID="Label3" runat="server" Text='<%# Bind("月份") %>'></asp:Label>
            </ItemTemplate>
            <HeaderStyle CssClass="grid-header" />
            <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="80px" />                                      
        </asp:TemplateField>    
       
       <asp:TemplateField HeaderText="油管销售量(吨)" SortExpression="油管销售量">
                                    <ItemTemplate>
                                        <asp:Label ID="Label16" runat="server" Text='<%# String.Format("{0:0.000}",Eval("油管销售量")) %>'></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox15" runat="server" Text='<%# Bind("油管销售量") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Right" Width="100px" />                                     
                                </asp:TemplateField>
        <asp:TemplateField HeaderText="套管销售量(吨)" SortExpression="套管销售量">
                                    <ItemTemplate>
                                        <asp:Label ID="Label7" runat="server" Text='<%# String.Format("{0:0.000}",Eval("套管销售量")) %>'></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("套管销售量") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Right" Width="100px" />                                     
                                </asp:TemplateField>  
        <asp:TemplateField ShowHeader="False">
            <ItemTemplate>
                <asp:Button ID="Button1" runat="server" CausesValidation="False" 
                    CommandName="Edit" Text="编辑" CssClass="smallbutton"/>
                &nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False" 
                    CommandName="Delete" Text="删除" CssClass="smallbutton"/>
            </ItemTemplate>
            <EditItemTemplate>
                <asp:Button ID="Button1" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="更新" CssClass="smallbutton"/>
                &nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False" 
                    CommandName="Cancel" Text="取消" CssClass="smallbutton"/>
            </EditItemTemplate>
        </asp:TemplateField>
    </Columns>
  </asp:GridView>
		            </td>
	            </tr>
	            <tr>
		            <td>
		                <table width="100%">
		                    <tr>
		                        <td class="pagebar">
                                    <asp:Button ID="Button_Pager_First" runat="server" Text="" ToolTip="首页" 
                                        CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" />
                                    <asp:Button ID="Button_Pager_Prev" runat="server" Text="" ToolTip="上一页" 
                                        CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" />
                                    <input type="button" class="page-split" />第<asp:TextBox ID="TextBox_Pager" runat="server" CssClass="pageturn" 
                                        ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" /><asp:Label ID="Label_Pages" runat="server"></asp:Label><input type="button" class="page-split" />
                                    
                                    <asp:Button ID="Button_Pager_Next" runat="server" Text="" ToolTip="下一页" 
                                        CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+" />
                                    <asp:Button ID="Button_Pager_Last" runat="server" Text="" ToolTip="末页" 
                                        CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" />
                                </td>
                                <td align="right">
                                    <asp:Label ID="Label_Total" runat="server" CssClass="grid_totalrows"></asp:Label>
                                </td>
                            </tr>
                       </table>

		            </td>
	            </tr>
            </table>
            

        </div>
    </div>
    
    </form>
<script>
    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }

    }
    var rows = document.getElementsByTagName("tr");
    for (i = 0; i < rows.length; i++) {

        if (rows[i].className == "grid-row-normal") {
            rows[i].onmouseover = function() { this.className = "grid-row-bright"; };
            rows[i].onmouseout = function() { this.className = "grid-row-normal"; };
        }
    }
    var tds = document.getElementsByTagName("td");
    for (i = 0; i < tds.length; i++) {
        if (tds[i].className == "detailheader") {
            tds[i].innerHTML = tds[i].innerHTML.replace("*", "<span class=required>*</span>");
        }
    }
</script>
</body>
</html>
